package com.study;

import com.study.entity.Event;
import com.study.chapter05.source.ClickSource;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Description:
 * @Author: LiuQun
 * @Date: 2022/7/28 10:49
 */
public class ModelTest {
    public static void main(String[] args) throws Exception {
        //环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        DataStreamSource<Event> stream = env.addSource(new ClickSource()).setParallelism(1);

        DataStreamSource<Event> stream2 = env.fromElements(
                new Event("Bob", "./home", 1000L),
                new Event("Livy", "./home", 2000L),
                new Event("Alice", "./cart", 3000L),
                new Event("Bob", "./cart", 2000L),
                new Event("Livy", "./prod?id=20", 4000L),
                new Event("Bob", "./prod?id=30", 5000L),
                new Event("Bob", "./home", 6000L),
                new Event("Alice", "./home/car", 7000L)
                );

        stream.print();
        stream2.print();

        env.execute();
    }
}
